import { Cartesian3, Math } from "cesium";
export const viewerInherit = {
  created() {
    this.viewer = this.$parent.viewer;
    this.eventBus = this.$parent.eventBus;
  }
};

export const contnt = {
  data() {
    return {
      initialView: {
        lng: 0,
        lat: 0,
        height: 0,
        heading: 0,
        pitch: 0,
        roll: 0
      }
    };
  },
  methods: {
    flyToInitialView(options = {}) {
      const { lng, lat, height, heading, pitch, roll } = this.initialView;
      this.viewer.camera.flyTo({
        destination: Cartesian3.fromDegrees(lng, lat, height),
        orientation: {
          heading: Math.toRadians(heading),
          pitch: Math.toRadians(pitch),
          roll: Math.toRadians(roll)
        },
        ...options
      });
    }
  }
};
